import Vue from "vue";
import VueRouter from "vue-router";
import index from '../components/index.vue'
import about from '../components/about.vue'
import movie from '../components/movie.vue'
import movie1 from '../components/movie1.vue'
import movie2 from '../components/movie2.vue'


Vue.use(VueRouter)


const router =new VueRouter({//路由实例
routes:[{
  path:'/',redirect:'/movie'
},{ //路由规则
  path:'/index',component:index
},{
  path:'/movie',component:movie,
  children:[{path:'',component:movie1},{path:'movie2',component:movie2}]
  //设置默认子路由可以吧path设置为空就行
  //子路由设置就是在那个页面里面加children，然后设置一个新的路由
  //子路由不设置/，直接写名字就是路径
},{
  path:'/about/:id',component:about,props:true
}]

})
router.beforeEach(function(to,from,next){
  next()

})
export default router